package com.zhuiyun.project.api.system.user.mapper;

import com.zhuiyun.project.api.system.user.entity.SysUser;
import com.zhuiyun.project.common.mapper.BaseMapper;
import com.zhuiyun.project.utils.pageUtil.PageResult;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.entity.Example;

import java.util.List;

@Mapper
public interface SysUserMapper extends BaseMapper<SysUser> {
    /**
     * @Author hyp
     * @Description 用户详情分页查询
     * @Date 2023/10/30 9:21
     * @Return com.zhuiyun.project.common.response.CommonResult
     * @param user
     */
    List<SysUser> listUsers(SysUser user);

    /**
     * @Author hyp
     * @Description 根据用户编号获取详情信息
     * @Date 2023/10/30 9:27
     * @Return com.zhuiyun.project.common.response.CommonResult
     * @param id
     */
    SysUser selectUserById(Integer id);

    /**
     * @Author hyp
     * @Description 根据用户编号删除用户
     * @Date 2023/10/30 9:31
     * @Return com.zhuiyun.project.common.response.CommonResult
     * @param userids
     */
    int removeUserByIds(Integer[] userids);

    /**
     * @Author hyp
     * @Description 修改用户
     * @Date 2023/10/30 9:31
     * @Return com.zhuiyun.project.common.response.CommonResult
     * @param user
     */
    int editUser(SysUser user);

    /**
     * @Author hyp
     * @Description 添加用户
     * @Date 2023/10/30 9:24
     * @Return com.zhuiyun.project.common.response.CommonResult
     * @param user
     */
    int addUser(SysUser user);

    /**
     * @Author hyp
     * @Description 校验用户名唯一
     * @Date 2023/10/30 9:24
     * @Return com.zhuiyun.project.common.response.CommonResult
     * @param loginName
     */
    SysUser checkLoginNameUnique(String loginName);

    /**
     * @Author hyp
     * @Description 校验用户名唯一
     * @Date 2023/10/30 9:24
     * @Return com.zhuiyun.project.common.response.CommonResult
     * @param phone
     */
    SysUser checkPhoneUnique(String phone);
    /**
     * @Author hyp
     * @Description 校验用户名唯一
     * @Date 2023/10/30 9:24
     * @Return com.zhuiyun.project.common.response.CommonResult
     * @param email
     */
    SysUser checkEmailUnique(String email);

    /**
     * @Author hyp
     * @Description 修改密码
     * @Date 2023/10/30 9:44
     * @Return com.zhuiyun.project.common.response.CommonResult
     * @param userId
     * @param password
     */
    int resetUser(@Param("userId") Integer userId, @Param("password") String password);


    /**
     * @Author hyp
     * @Description  修改用户头像
     * @Date 2023/10/30 13:42
     * @Return com.zhuiyun.project.common.response.CommonResult
     * @param avatarId
     * @param id
     */
    int updateAvatarId(@Param("avatarId") String avatarId, @Param("id") Integer id);

    /**
     * @Author hyp
     * @Description 根据登录名查询用户信息
     * @Date 2023/10/30 19:51
     * @Return com.zhuiyun.project.api.system.user.entity.SysUser
     * @param loginName
     */
    SysUser getUserByLoginName(String loginName);
    /**
     * @Author hyp
     * @Description 查询已分配用户角色列表
     * @Date 2023/10/26 14:33
     * @Return com.zhuiyun.project.common.response.CommonResult
     * @param user
     */
    List<SysUser> selectAllocatedList(SysUser user);
    /**
     * @Author hyp
     * @Description 查询未分配用户角色列表
     * @Date 2023/10/26 14:33
     * @Return com.zhuiyun.project.common.response.CommonResult
     * @param user
     */
    List<SysUser> selectUnallocatedList(SysUser user);
}
